#include "Sprite.h"
#include<QPixmap>
Sprite::Sprite() {}
Sprite::Sprite(int dx,int dy,int x,int y,const QString &fliename)
    :position(x,y){
    QPixmap pix1;
    pix1.load(fliename);
    pixmap=pix1.scaled(dx,dy,Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
void Sprite::update(){
    position+=speed*velocity;
    collider=QRect(position.toPoint(),pixmap.size());
}
void Sprite::draw(QPainter *painter){
    painter->drawPixmap(position.toPoint(),pixmap);
}
void Sprite::moveBy(int x,int y){
    position+=QVector2D(x,y);
}
void Sprite::setpos(int x,int y){
    position.setX(x);
    position.setY(y);
}
